<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>创建订单</title>

    <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>

    <script type="text/javascript">
        function create() {
            $.ajax({
                url: '/createOrder',
                type: 'POST',    //GET
                async: false,    //或false,是否异步
                data: {},
                timeout: 5000,    //超时时间
                dataType: 'json', //返回的数据格式：json/xml/html/script/jsonp/text
                success: function (data) {
                    if ("1" === data.code) {
                        //alert("创建订单成功~~~" + data.orderId);
                        window.location.href = "waitingPay.html?orderId=" + data.orderId;
                    } else {
                        alert("创建订单失败~~~,message:" + data.message);
                    }
                }
            })
        }

    </script>
</head>
<body>


<form>
    <table class="lp-login">
        <tr align="center">
            <td colspan="2">
                <button class="submitBtn" onclick="create();return false;" value="创建订单">创建订单</button>
            </td>
        </tr>
    </table>
</form>

</body>
</html>
